Skip to content

[CI] update code.coverage job to report on all components and preview features#4002

Open
dbarker wants to merge 8 commits intoopen-telemetry:mainfrom
dbarker:ci_update_code_coverage_test
Open

[CI] update code.coverage job to report on all components and preview features#4002
dbarker wants to merge 8 commits intoopen-telemetry:mainfrom
dbarker:ci_update_code_coverage_test

Conversation

@dbarker
Copy link
Copy Markdown
Member

@dbarker dbarker commented Apr 15, 2026

Fixes # (issue)

Code coverage does not include all components and preview features. This PR expands coverage reporting.

Changes

  • run the coverage test with test_common/cmake/all-options-abiv2-preview.cmake CMake cache to cover all components and preview features with ABI v2.
  • update the ci code coverage runner to Ubuntu 24.04

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@dbarker dbarker changed the title [CI] update code.coverage job and script target [CI] update code.coverage job to report on all components and preview features Apr 15, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.79%. Comparing base (07d40f5) to head (b73a204).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4002      +/-   ##
==========================================
- Coverage   90.32%   81.79%   -8.52%     
==========================================
  Files         230      374     +144     
  Lines        7298    15766    +8468     
==========================================
+ Hits         6591    12895    +6304     
- Misses        707     2871    +2164     

see 263 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbarker dbarker marked this pull request as ready for review April 15, 2026 17:19
@dbarker dbarker requested a review from a team as a code owner April 15, 2026 17:19
@dbarker
Copy link
Copy Markdown
Member Author

dbarker commented Apr 15, 2026

Updated report shows the coverage of components not previously included (otlp exporters, resource detectors, ...):
https://app.codecov.io/gh/open-telemetry/opentelemetry-cpp/commit/0f04c99de95cf151347fc430a7dedca1520d75e4/tree?dropdown=coverage

Copy link
Copy Markdown
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the fix.

Comment thread ci/do_ci.sh
--exclude "${SRC_DIR}/*/test/*" \
--exclude "${SRC_DIR}/functional/*" \
--exclude "${SRC_DIR}/semconv/*" \
--exclude "${SRC_DIR}/examples/*" \
Copy link
Copy Markdown
Member

@marcalff marcalff Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also exclude '/ext/http/server/' as before, the http server is test code, not a deliverable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing that out. I can see ext/http/server headers are only used in tests and an example. They are installed for public use at the moment though. I'll move them to test_common in a separate PR.

Comment thread ci/do_ci.sh Outdated
Comment thread ci/do_ci.sh Outdated
--exclude "${SRC_DIR}/functional/*" \
--exclude "${SRC_DIR}/semconv/*" \
--exclude "${SRC_DIR}/examples/*" \
--ignore-errors gcov,mismatch,negative,unused \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which lcov errors is this suppressing in practice? mismatch and negative usually point at a real coverage-build bug.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing that out. I've updated the ignore args. Only unused was still needed after applying all the exclude args (prior errors where coming from still parsing the tests and examples).

The unused arg bypasses errors like:

geninfo: ERROR: 'exclude' pattern '/workspaces/opentelemetry-cpp/third_party/*' is unused.
        (use "geninfo --ignore-errors unused ..." to bypass this error)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added -fprofile-update=atomic given this error.

geninfo: ERROR: Unexpected negative count '-3406' for /home/runner/work/opentelemetry-cpp/opentelemetry-cpp/api/include/opentelemetry/common/spin_lock_mutex.h:117.
	Perhaps you need to compile with '-fprofile-update=atomic
	(use "geninfo --ignore-errors negative ..." to bypass this error)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants